<link href="${rc.getContextPath()}/manage/css/dwzCustomCss/dwz.custom.css?v=${ver}" rel="stylesheet" type="text/css">
<style>
</style>
<div class="pageContent">
    <form id="" method="post" action="${rc.getContextPath()}/manage/personnelException/savePersonnelException" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone);">
        <div class="pageFormContent" layoutH="58" style="overflow:auto;">
            <fieldset>
                <input type="hidden" name="navTabId" value="${navTabId!''}" />
                <input type="hidden" name="id" value="<#if (personnelType.id)??>${personnelType.id!''}</#if>"> 
                <dl class="notnormal">
                    <dt><@label key='personnelCode.C,colon'>人员编号：</@label></dt> 
                    <dd><input class="required look" id="personnelException.personnelCode" name="personnelCode" type="text" postField="personnelCode" suggestFields="personnelCode,personnelName,workCenterCode,workCenterText" 
                    callback="setPersonnelInfo" suggestUrl="${rc.getContextPath()}/manage/personnel/personnelSuggest" lookupGroup="personnelLookup" value="${personnel.personnelCode!''}"
                    warn="<@label key='personnelCode.C,doesNotExist.C'>人员编号不存在</@label>"  
                    />
                    <a class="btnLook" callback="setPersonnelInfo" href="${rc.getContextPath()}/manage/personnel/personnelLookUp" rel="personnelLookup_dialog" width="700" height="450" lookupGroup="personnelLookup" title="<@label key='queryPersonnel.D'>人员选择</@label>"></a>
                    </dd>
                </dl>
                
                <dl>
                    <dt><@label key='personnelName.C,colon'>人员名称：</@label></dt>
                    <dd><input type="text" readonly="readonly" class="readonly" name="personnelName" value="${personnelException.personnelName!''}"/></dd>
                </dl>
            
                <dl>
                    <dt><@label key='personnelTypeCode.C,colon'>人员类型编号：</@label></dt>
                    <dd><select name="personnelTypeCode" class="required">
                        <option value="" ><@label key='select.C'>请选择</@label></option>
                    </select></dd>
                </dl>
                
                <dl>
                    <dt><@label key='personnelTypeText.C,colon'>类型描述：</@label></dt>
                    <dd><input type="text" readonly="readonly" class="readonly" name="typeText" value="${personnelException.typeText!''}"/></dd>
                </dl>
                
                <dl class="notnormal">
                    <dt><@label key='startTime.C,colon'>开始时间：</@label></dt>
                    <dd><input type="text" name="startDateTime" value="${(personnelException.startDateTime?string('yyyy-MM-dd HH:mm:ss'))?if_exists}" 
                        max_date="{endDateTime}" class="date required"  dateFmt="yyyy-MM-dd HH:mm:ss"/>
                    <a class="inputDateButton" href="javascript:;">选择</a></dd>
                </dl>
                
                <dl>
                    <dt><@label key='skillLevele.C,colon'>等级：</@label></dt>
                    <dd><input type="hidden" name="skillLevelECode">
                    <select disabled="disabled" class="readonly" name="skillLevelEText">
                    <#if killLevele??>
                        <#list killLevele as ecode>
                            <option value="${ecode.eCode!''}" >${ecode.eCodeText!''}</option>
                        </#list>
                    </#if>
                    </select></dd>
                </dl>
                
                <dl class="notnormal">
                    <dt><@label key='endTime.C,colon'>结束时间：</@label></dt>
                    <dd><input type="text" name="endDateTime" value="${(personnelException.endDateTime?string('yyyy-MM-dd HH:mm:ss'))?if_exists}" 
                        min_date="{startDateTime}" class="date required"  dateFmt="yyyy-MM-dd HH:mm:ss"/>
                    <a class="inputDateButton" href="javascript:;">选择</a></dd>
                </dl>
                
                <dl>
                    <dt><@label key='workCenter.C,colon'>工作中心：</@label></dt>
                    <dd><input type="hidden" name="workCenterCode" value="${personnelException.workCenterCode!''}"/>
                    <input type="text" readonly="readonly" class="readonly" name="workCenterText" value="${personnelException.workCenterText!''}"/>
                    </dd>
                </dl>
                <dl class="nowrap">
                    <dt><@label key='memo.C,colon'>备注：</@label></dt>
                    <dd>
                        <textarea rows="3" cols="83" name="memo" class="textInput " maxlength="200"></textarea>
                    </dd>
                </dl>
               </fieldset>
        </div>
        <div class="formBar">
            <ul>
                <li><div class="buttonActive" id="save">
                        <div class="buttonContent">
                            <button type="submit" ><@label key="save.B">确定</@label></button>
                        </div>
                    </div></li>
                <li>
                    <div class="buttonActiveGrey">
                        <div class="buttonContent">
                            <button type="button" class="close"><@label key="cancel.B">取消</@label></button>
                        </div>
                    </div>
                </li>
            </ul>
        </div>

    </form>
</div>

<script language="javascript">
var addPersonnelExceptionDialog = $.pdialog.getCurrent();
function setPersonnelInfo(_args){
    var personnelCode = _args.personnelCode;
    $("input[name='personnelCode']", addPersonnelExceptionDialog).val(personnelCode);
    $("input[name='personnelName']", addPersonnelExceptionDialog).val(_args.personnelName);
    $("input[name='workCenterCode']", addPersonnelExceptionDialog).val(_args.workCenterCode);
    $("input[name='workCenterText']", addPersonnelExceptionDialog).val(_args.workCenterText);
    if(personnelCode && personnelCode!=""){
        $.DWZajax({
            url:hostUrl +"/ptassign/getPTAsByPersonnel",
            data:{'personnelCode':personnelCode},
            callback:function(data){
                if(data && data.length > 0){
                    $("select[name='personnelTypeCode']", addPersonnelExceptionDialog).html("<option value='' ><@label key='select.C'>请选择</@label></option>");
                    for(var i=0; i<data.length; i++){
                        var $option = $('<option value="'+data[i].personnelTypeCode+'">'+data[i].personnelTypeCode+'-'+data[i].typeText+'</option>');
                        $option.data('typeAssign',data[i]);
                        $("select[name='personnelTypeCode']", addPersonnelExceptionDialog).append($option);
                    }
                    $("select[name='personnelTypeCode']").on('change',function(){
                        var txt = $(this).find('option:selected').data('typeAssign');
                        $("input[name='typeText']", addPersonnelExceptionDialog).val(txt.typeText);
                        $("input[name='skillLevelECode']", addPersonnelExceptionDialog).val(txt.skillLeveleCode);
                        $("select[name='skillLevelEText']", addPersonnelExceptionDialog).val(txt.skillLeveleCode);
                    });
                }
            }
        });
    }
}
</script>
